// * 请求响应参数(不包含data)
export interface Response {
  code: number
  type: 'success' | 'error' | 'warning'
  message: string
}

// * 请求响应参数(包含data)
export interface ResponseData<T = any> extends Response {
  result: T
}

// * 分页响应参数
export interface ResPage<T> {
  datalist: T[]
  pageNum: number
  pageSize: number
  total: number
}

// * 分页请求参数
export interface ReqPage {
  pageNum: number
  pageSize: number
}

// * 登录模块
export namespace Login {
  export interface ReqLoginForm {
    username: string
    password: string
  }
  export interface ResLogin {
    token: string
  }
  export interface ResAuthButtons {
    [key: string]: string[]
  }
}

// * 图表模块
export namespace Charts {
  export interface ResPie {
    legendData: string[]
    seriesData: {
      name: string
      value: number
    }[]
  }
}

// * 用户管理模块
export namespace User {
  export interface ReqGetUserParams extends ReqPage {
    username: string
    gender: number
    idCard: string
    email: string
    address: string
    createTime: string[]
    status: number
  }

  export interface ResUserList {
    id: string
    username: string
    gender: string
    age: number
    idCard: string
    email: string
    address: string
    createTime: string
    status: number
    avatar: string
    children?: ResUserList[]
  }
  export interface ResStatus {
    userLabel: string
    userValue: number
  }
  export interface ResGender {
    genderLabel: string
    genderValue: number
  }
  export interface ResDepartment {
    id: string
    name: string
    children?: ResDepartment[]
  }
}

// * 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    fileUrl: string
  }
}
